import { match } from 'path-to-regexp/dist'

import { getCurrentPage } from '@/utils'

const list = ['pages/identity/(.*)', 'pages/redirect/(.*)'] as string[]

export default list

const matchFnList = list.map((o) => match(o, { decode: decodeURIComponent }))

export function pageUrlMatch(url: string) {
  return matchFnList.some((o) => o(url))
}

export function currentPageMatch() {
  const { route } = getCurrentPage()
  return pageUrlMatch(route as string)
}
